package com.warehouseconsumer.controller;

import com.warehouseconsumer.service.ZStockConsumerService;
import entity.ResponseMessage;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@CrossOrigin
@RequestMapping("/stock")
public class ZStockConsumerController {
    private Logger logger=Logger.getLogger(this.getClass());

    @Resource
    private ZStockConsumerService zStockConsumerService;
    @RequestMapping("/getFyStock")
    @ResponseBody
    public ResponseMessage getFyStock(@RequestParam(value = "pname",required = false) String pname, @RequestParam(value = "type",required = false) Integer type, @RequestParam("pageNo") int pageNo){
        logger.info("ZStockConsumerController stock getFyStock pname:"+pname+",type:"+type+",pageNo:"+pageNo);
        ResponseMessage msg=new ResponseMessage();
        msg=zStockConsumerService.getFyStock(pname,type,pageNo,3);
        return msg;
    }
}
